/*  
* Copyright (c) 2010, James Daniello
* This project is licensed under the 'New BSD' license.
* The full text of the license can be found in the root
* directory under the filename "LICENSE"
*/
package src.gui;

import javax.swing.JApplet;
import javax.swing.SwingUtilities;


public class PICAIUClientApplet extends JApplet{

  //Client end of PICAIU
  PICAIUClient client;
  
  /**
  * Called when the applet is ready to run. It creates an instance of the 
  * chat client. The client is passed this applet so it knows where to 
  * render the GUI components.
  */
  public void init(){
  
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      startClient();
    }
  });
  }
  
  /**
  * Starts the PICAIUClient application
  */
  public void startClient(){
  client = new PICAIUClient(this);
  }
  
  /**
  * Called when the applet is closing. It tells the client to clean up
  * and notify the server that it is disconnecting. Then it exits.
  * The call to System.exit(1) may be redundant.
  */
  public void stop(){
    client.exitClient();
    System.exit(1);
  }
}